/**
 * Copyright (C) 2017 - 2020 https://github.com/joewee
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.service;

import com.bifrost.common.model.ResultModel;
import com.bifrost.entity.MerchantStore;
import com.bifrost.entity.Order;
import com.bifrost.entity.User;
import com.bifrost.model.OrderRequest;
import com.bifrost.model.vo.MerchantStoreVO;
import com.bifrost.model.vo.PageVO;
import org.springframework.data.domain.Page;

import java.util.List;

/**
 * @author joewee
 * @version 1.0.0
 * @Date 2017/11/1 11:44
 */
public interface StoreService {
    /**
     * 查询所有门店
     *
     * @return
     */
    List<MerchantStore> getMerchantStores();

    /**
     * 查询某区域内的门店
     *
     * @param areaId
     * @return
     */
    List<MerchantStore> getMerchantStores(Long areaId);

    /**
     * 获取门店详情
     *
     * @param merchantId
     * @return
     */
    MerchantStore getMerchantStore(Long merchantId);

    ResultModel getMerchantStoreInfo(Long merchantId);

    /**
     * 根据门店外部系统id获取门店
     * @param id
     * @return
     */
    MerchantStore getMerchantStoreByExternalId(String  id);

    /**
     * 查询门店服务费计价策略
     *
     * @param merchantId 门店id
     * @return 返回计价策略MAX、SUM
     */
    String getMerchantStorePricingModel(Long merchantId);

    boolean canService(OrderRequest request);

    boolean canService(Order order);

    /**
     * 获取后台门店
     *
     * @return
     */
    Page<MerchantStore> getAdminMerchantStores(Integer page, Integer pageSize, String storeName, Long areaId, String storeCode, String externalIds);

    /**
     * 后台新增/更新门店
     * @param store
     * @return
     */
    MerchantStore save(MerchantStore store);

    /**
     * 后台删除门店
     * @param merchantIds
     * @return
     */
    void deleteByMerchantId(String merchantIds);

    /**
     * 根据id和name查询当前用户所拥有的权限门店
     * @param user
     * @param merchantId
     * @param merchantName
     * @param merchantCode
     * @param pageCode
     * @param pageSize
     * @return
     */
    PageVO havePermission(User user, Long merchantId, String merchantName, String merchantCode, Integer pageCode, Integer pageSize);

    /**
     * 根据id和name查询当前用户所拥有的权限所有门店
     * @param user
     * @param merchantId
     * @param merchantName
     * @param merchantCode
     * @return
     */
    List<MerchantStoreVO> havaPermissionWithUser(User user, Long merchantId, String merchantName, String merchantCode);

    List<MerchantStore> getAllMerchantStores();

    /**
     * 获取门店基本信息
     *
     * @param merchantStoreId merchantStoreId
     * @return
     */
    MerchantStoreVO getMerchantStoreVO(Long merchantStoreId);
}
